package com.yingsheng.bi.hks.template.utils;

import com.yingsheng.bi.hks.template.events.Event;

import java.util.Map;

public class TemplateContext {

    private static volatile ThreadLocal<TemplateContext> contextTL = new ThreadLocal<TemplateContext>() {
        protected TemplateContext initialValue() {
            return new TemplateContext();
        }
    };

    public static void setRequestContext(TemplateContext templateContext) {
        contextTL.set(templateContext);
    }

    public static TemplateContext getRequestContext() {
        return contextTL.get();
    }

    public static void reset() {
        contextTL.remove();
    }

    private boolean support;

    public boolean isSupport() {
        return support;
    }

    public void setSupport(boolean support) {
        this.support = support;
    }

    private Event event;

    private String template;

    public String getTemplate() {
        return template;
    }

    public void setTemplate(String template) {
        this.template = template;
    }

    private Map<String, Object> props;

    public void setEvent(Event event) {
        this.event = event;
    }

    public Event getEvent() {
        return this.event;
    }

    public Map<String, Object> getProps() {
        return this.props;
    }

    public void setProps(Map<String, Object> props) {
        this.props = props;
    }

}
